<!doctype html>
<html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false"%>
<head>
    <title>视频监控</title>
    <%@ include file="videoHead.jsp"%>
</head>
<body >
<div style="height:100%;width100%;background: url(${appCtx}resources/images/video/bg.jpg) #ededed no-repeat 50% 0;">
		<div id="gdMap"  style="display:none;height:60%;width:100%"></div>
		<div id="speedDiv" style="display:none;height:40%;width:100%" >
			<div id="speedCharts" style="width:100%;height: 100%;"></div>
		</div>
		<div id="tooldiv" style="position: absolute;z-index: 99;right: 10px;top:5px;">
		<button style="display:none;" onclick="downloadVideoControl()">下载视频控件</button>
		<select style="display:none;width:130px;margin: 0px;" id="timeOutSel">
		<option value ="300" selected="selected">5分钟后关闭</option>
  		<option value ="600">10分钟后关闭</option>
  		<option value="1200">20分钟后关闭</option>
  		<option value="1800">30分钟后关闭</option>
  		</select>
  		<span style="display:none;" id="t_m">00分</span> 
		<span style="display:none;" id="t_s">00秒</span>
		<button style="display:none;" id="closeVideoDiv" >关闭视频</button>
		<select class="videoSelect" id="selectVehicleSel" onchange="changeVechile()"  style="width:100px;margin: 0px;">
		</select>
	</div>

	
</div>
<!-- 用于控制弹出窗口- -->
<a id="txtOpenWindow" target="_self" style="display: none"></a>

<script>
var isinitselect = false;	
var  appCtx="${appCtx}";
var vehicleID =0 ;
var positionNum='${position}';
$(function(){ 
	try{
		initVehicleList();
	}catch(e){
		  
	}
});


function initVehicleList(){
	$.ajax({
		type : 'post',
		async : false,
		url : appCtx + "/video/queryVideoVehicleList.html",
		cache : false,
		dataType : "JSON",
		success : function(data) {
			if(data){

				$('#selectVehicleSel').select2({
				  data: data
				})
				
			}
		}
	});

}

		
	
	
//打开新窗体
function openWindow(url){
	var openLink = $("#txtOpenWindow");
	openLink.attr('href', url);
	openLink[0].click();
}

function changeVechile(){
	if(isinitselect){
		isinitselect=false;
	}else{
			var vid=$("#selectVehicleSel").val();
			if(parent.window.vehicleID1==vid&&vid!=0){
				alert("左上监控区域正在监控该车辆！");
				isinitselect=true;
				$('#selectVehicleSel').val(vehicleID).trigger("change");
				return;
			}
			if(parent.window.vehicleID2==vid&&vid!=0){
				alert("右上监控区域正在监控该车辆！");
				isinitselect=true;
				$('#selectVehicleSel').val(vehicleID).trigger("change");
				return;
			}
			if(parent.window.vehicleID3==vid&&vid!=0){
				alert("左下监控区域正在监控该车辆！");
				isinitselect=true;
				$('#selectVehicleSel').val(vehicleID).trigger("change");
				return;
			}
			if(parent.window.vehicleID4==vid&&vid!=0){
				alert("右下监控区域正在监控该车辆！");
				isinitselect=true;
				$('#selectVehicleSel').val(vehicleID).trigger("change");
				return;
			}
			try{
				parent.window.changeIframe(vid,positionNum);
			}catch(e){
				
			}
	}
}


</script>
</body>
</html>
